package com.zs.mp.model;



import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {
	// 状态码
	private Integer code;
	// 提示信息
	private String message;
	// 响应数据
	private T data;
	
	public static <E> ResponseResult<E> success(E data){
		return new ResponseResult<E>(0, null, data);
	}
	
	public static <E> ResponseResult<E> success(){
		return new ResponseResult<E>();
	}
	
	public static <E> ResponseResult<E> success(String message){
		return new ResponseResult<E>(0,message,null);
	}
	
	public static <E> ResponseResult<E> failure(String message){
		return new ResponseResult<E>(1,message,null);
	}
}
